#include <algorithm>
#include <array>
#include <cmath>
#include <fmt/format.h>
#include <iostream>
#include <iterator>
#include <ostream>
#include <vector>

int main()
{
    double x = INFINITY;
    double y = NAN;
    std::array values{ 1, 2, 3, 4'123 };
    std::ostream_iterator<int> output{ std::cout, " " };
    std::cout << "values contains: ";
    std::ranges::copy(values, output);
    std::cout << "\n";

    std::cout << "Display each element multiplied by two: ";
    std::ranges::for_each(values, [](auto i) { std::cout << i * 2 << " "; });
    std::cout << "\n";

    int sum{ 0 };
    std::ranges::for_each(values, [&sum](auto i) { sum += i; });
    std::cout << "\nSum of value's elements is: " << sum << "\n";
    return 0;
}